﻿namespace CSharpPro.properties._0923;

public class Demo
{
    public void TestPrint()
    {}
    public void TestPrint2()
    {
        int num = 2020;
        bool flag = (num % 4 == 0 && num % 100 != 0) || num % 400 == 0;
    }

    public double TestPrint3(int month, string transport)
    {
         
        const double originalPrice = 8800;
        double discountRate = 0;

        // 判断是否为旺季（5~10月）
        bool isPeakSeason = month >= 5 && month <= 10;

        // 根据季节和交通方式确定折扣率
        if
            (isPeakSeason)
        {
            if (transport == "航班")
                discountRate = 0.9;   // 旺季航班打9折
            else if (transport == "动车")
                discountRate = 0.75;  // 旺季动车打7.5折
        }
        else
        {
            if (transport == "航班")
                discountRate = 0.6;   // 淡季航班打6折
            else if (transport == "动车")
                discountRate = 0.3;   // 淡季动车打3折
        }

        // 计算并返回最终价格
        return originalPrice * discountRate;
    }
}